package com.xxgc.springboot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxgc.springboot.entity.Users;
import com.xxgc.springboot.mapper.UsersMapper;
import com.xxgc.springboot.service.IUsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户 服务实现类
 * </p>
 *
 * @author Mr.Abel
 * @since 2022-09-27
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements IUsersService {

    @Override
    public Users selectByNameAndPass(String uName, String uPass) {
        QueryWrapper<Users> qw = new QueryWrapper<>();
        qw.eq("uname",uName);
        qw.eq("upass",uPass);
        return getOne(qw);
    }

    @Override
    public List<String> selectPerByUserId(Integer id) {
        return baseMapper.selectPermByUserId(id);
    }

    @Override
    public String selectRoleByUserId(Integer id) {
        return baseMapper.selectRoleByUserId(id);
    }
}
